package com.entrogy.utils;


import com.Sinewecology.SendMessage.MobileMsgDataBean;
import com.Sinewecology.SendMessage.WechatMsgDataBean;
import com.Sinewecology.SendMessage.WillSendMessageList;
import com.Sinewecology.config.ConfigParams;
import com.entrogy.bean.PubCountEntity;

/**
 *
 * Description: 发送微信推送的工具类
 *
 * @author xlr
 *
 *
 *
 */

public class SendUtils {

	public static void sendByWeixin(PubCountEntity pubCountEntity, String[] params, String templateId) {
		WechatMsgDataBean wechatMsgDataBean = new WechatMsgDataBean();
		wechatMsgDataBean.setKeyword(params);
		wechatMsgDataBean.setPubCountEntity(pubCountEntity);
		wechatMsgDataBean.setTemplateId(templateId);
		WillSendMessageList.insertToWechatMsgList(wechatMsgDataBean);
	}

	// 短信推送
	public static void sendByShortMessage(String phoneNumber, String[] params, String templateId) {
		MobileMsgDataBean mobileMsgDataBean = new MobileMsgDataBean();
		mobileMsgDataBean.setKeyword(params);
		mobileMsgDataBean.setPhoneNumber(phoneNumber);
		mobileMsgDataBean.setTemplateId(templateId);
		WillSendMessageList.insertToMobileMsgList(mobileMsgDataBean);
	}

	public static void sendByWeixinAndPath(PubCountEntity pubCountEntity, String[] params, String templateId,String path) {
		WechatMsgDataBean wechatMsgDataBean = new WechatMsgDataBean();
		wechatMsgDataBean.setKeyword(params);
		wechatMsgDataBean.setPubCountEntity(pubCountEntity);
		wechatMsgDataBean.setTemplateId(templateId);
		wechatMsgDataBean.setPagepath(path);
		wechatMsgDataBean.setMiniProgramAppId(ConfigParams.APPID_littleProgram);
		WillSendMessageList.insertToWechatMsgList(wechatMsgDataBean);
	}

	public static void sendByShortMessageWithRecord(String phoneNumber, String[] params, String templateId, Integer messageRecordId) {
		MobileMsgDataBean mobileMsgDataBean = new MobileMsgDataBean();
		mobileMsgDataBean.setKeyword(params);
		mobileMsgDataBean.setPhoneNumber(phoneNumber);
		mobileMsgDataBean.setTemplateId(templateId);
		mobileMsgDataBean.setMessageRecordId(messageRecordId);
		WillSendMessageList.insertToMobileMsgList(mobileMsgDataBean);
	}

    public static void sendByWeixinWithRecord(PubCountEntity pubCountEntity, String[] paramsWeiXin, String weixinTemplateid, Integer messageRecordId) {
		WechatMsgDataBean wechatMsgDataBean = new WechatMsgDataBean();
		wechatMsgDataBean.setKeyword(paramsWeiXin);
		wechatMsgDataBean.setPubCountEntity(pubCountEntity);
		wechatMsgDataBean.setTemplateId(weixinTemplateid);
		wechatMsgDataBean.setMessageRecordId(messageRecordId);
		WillSendMessageList.insertToWechatMsgList(wechatMsgDataBean);
    }
}

